

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int a[] = new int[n];
       int b[] = new int[1000100];
       for(int i = 0;i < n;i ++){
           a[i] = sc.nextInt();
       }
       int cnt = 0;
       int temp = 0;
       boolean flag = false;
       for(int v = 30;v >= 0;v --){
           cnt = 0;
           temp = (1 << v) - 1;
           for(int j = 0;j < n;j ++){
               if(((a[j] >> v) & 1 )== 1){
                   temp = (temp & a[j]);
                   b[cnt ++] = a[j];
               }
           }
           if(temp == 0){
               System.out.println(cnt);
               for(int i = 0;i < cnt - 1;i ++)
                   System.out.print(b[i] + " ");
               System.out.println(b[cnt - 1]);
               flag = true;
               break;
           }
       }
       if(flag == false){
           System.out.println("-1");
       }

    }
}